Skip to content

Support i64.add/sub128 instructions from Wide Arithmetic proposal#8638

Merged
stevenfontanella merged 4 commits intomainfrom
wide-arithmetic
Apr 28, 2026
Merged

Support i64.add/sub128 instructions from Wide Arithmetic proposal#8638
stevenfontanella merged 4 commits intomainfrom
wide-arithmetic

Conversation

@stevenfontanella
Copy link
Copy Markdown
Member

@stevenfontanella stevenfontanella commented Apr 21, 2026

Part of #8544

i64 to i32 lowering isn't implemented yet because supporting multi-value i64 returns requires more work here. Will add this in a separate change.

Spec tests are adapted from the upstream proposal repo, with only tests related to i64.add128 and i64.sub128 included.

Drive-by changes:

  • Remove unneeded template params in wasm-validator.cpp
  • Unconditionally assign to the result in ckd_add / ckd_sub polyfills to match the behavior of the std implementations. All of the existing callers don't observe the result when overflow occurred, but for our case we need the value regardless.

@stevenfontanella stevenfontanella changed the title WIP: Support wide arithmetic instructions WIP: Support i64.add128 instruction from Wide Arithmetic Proposal Apr 21, 2026
@stevenfontanella stevenfontanella force-pushed the wide-arithmetic branch 3 times, most recently from fcaeb5c to 05f832e Compare April 22, 2026 23:34
@stevenfontanella stevenfontanella changed the base branch from main to wide-arithmetic-features April 23, 2026 00:14
@stevenfontanella stevenfontanella force-pushed the wide-arithmetic-features branch from 8b5d54c to 1891d2d Compare April 23, 2026 05:00
Base automatically changed from wide-arithmetic-features to main April 23, 2026 16:09
@stevenfontanella stevenfontanella changed the title WIP: Support i64.add128 instruction from Wide Arithmetic Proposal WIP: Support i64.add/sub128 instructions from Wide Arithmetic proposal Apr 27, 2026
@stevenfontanella stevenfontanella force-pushed the wide-arithmetic branch 3 times, most recently from 784490c to 7e839a0 Compare April 27, 2026 20:18
@stevenfontanella stevenfontanella changed the title WIP: Support i64.add/sub128 instructions from Wide Arithmetic proposal Support i64.add/sub128 instructions from Wide Arithmetic proposal Apr 27, 2026
@stevenfontanella stevenfontanella marked this pull request as ready for review April 27, 2026 22:16
@stevenfontanella stevenfontanella requested a review from a team as a code owner April 27, 2026 22:16
@stevenfontanella stevenfontanella requested review from kripken and removed request for a team April 27, 2026 22:16
Comment thread src/wasm-delegations-fields.def
Copy link
Copy Markdown
Member

@kripken kripken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm % comment

Comment thread src/support/stdckdint.h
Comment thread src/wasm/wasm-validator.cpp Outdated
Comment thread src/wasm/wasm.cpp Outdated
@stevenfontanella stevenfontanella enabled auto-merge (squash) April 28, 2026 22:44
@stevenfontanella stevenfontanella merged commit c6a5e65 into main Apr 28, 2026
16 checks passed
@stevenfontanella stevenfontanella deleted the wide-arithmetic branch April 28, 2026 23:57
Comment thread src/wasm/wasm-type.cpp
return i16Array;
}

Type getI64Pair() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's either remove this or move it to a different namespace; a pair is not a heap type.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, sent #8658 for this.

@kripken
Copy link
Copy Markdown
Member

kripken commented Apr 30, 2026

I think we need to mark the testcase here as non-fuzzable? V8 gives me errors on needing the wide-arithmetic flag, which it seems we don't pass (and if I pass it, it errors on a missing opcode)

@stevenfontanella
Copy link
Copy Markdown
Member Author

I think we need to mark the testcase here as non-fuzzable? V8 gives me errors on needing the wide-arithmetic flag, which it seems we don't pass (and if I pass it, it errors on a missing opcode)

Thanks, will send a fix now.

@stevenfontanella
Copy link
Copy Markdown
Member Author

Sent #8663.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants